package my.edu.model.information.entity.dto;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.groups.Default;
import lombok.Data;
import my.edu.common.validate.groups.Insert;
import my.edu.common.validate.IntegerPattern;

@Data
public class AddressSaveDTO {
    @Null(message = "id必须为空",groups = Insert.class)
    @NotNull(message = "id不能为空" ,groups = { Default.class})
    private String id;
    @NotBlank(message = "联系人不能为空")
    private String contactPerson;//联系人
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式错误")
    private String phone;
    @NotBlank(message = "省不能为空",groups ={Insert.class,Default.class} )
    private String province;//省
    @NotBlank(message = "市不能为空",groups ={Insert.class,Default.class} )
    private String city;//市
    @NotBlank(message = "区不能为空",groups ={Insert.class,Default.class} )
    private String district;//区
    @NotBlank(message = "详细地址不能为空",groups = {Insert.class,Default.class} )
    private String detailedAddress;//详细地址
    @IntegerPattern(regexp = "^[01]$", message = "是否默认寄件参数错误", groups = {Insert.class, Default.class})
    private Integer isDefaultShipping;//默认寄件
    @IntegerPattern(regexp = "^[01]$", message = "是否默认发货参数错误", groups = {Insert.class, Default.class})
    private Integer isDefaultDelivery;//默认发货

    public AddressSaveDTO(){
        this.isDefaultShipping = 0;
        this.isDefaultDelivery = 0;
    }


}
